import api from "@/api/apiConfig";
import ajax from "@/api/http";
import store from "@/store/index.js";

export function share () {
	if(store.state.isLogin){
		ajax.post(api.shareWeChart).then(res => {
			if(res.is_watch === 1) {
				uni.showModal({
				  title: '分享',
				  content:'恭喜您分享成功,获得' + res.int + '积分',
				  showCancel: false,
				  confirmText: '知道了'
				})
			}
		      })
		      .catch(err => {
		        ﻿uni.showToast({
		          title: err,
		          icon: 'none',
		          duration: 2000
		        })
		      });
	}
}

export default {
  share
}
